<%@page import="db.dao.*"%>
<%@ page language="java" contentType="text/html;" import="java.util.*" pageEncoding="UTF-8" %>
<%
response.setContentType("text/html;charset=UTF-8");
request.setCharacterEncoding("UTF-8");
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
StudentDAO sDao = new StudentDAO();
Student stu = sDao.findById((String)session.getAttribute("username"));
%>

<!DOCTYPE html>
<html lang="zh">
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<title>教务系统学生界面</title>
		
		<link href="css/jquery-accordion-menu.css" rel="stylesheet" type="text/css" />
		<link href="css/font-awesome.css" rel="stylesheet" type="text/css" />
		<link rel="stylesheet" type="text/css" href="css/stm.css" />
		<link href='http://cdn.webfont.youziku.com/webfonts/nomal/104133/46121/594dd3a9f629d81270e07074.css' rel='stylesheet' type='text/css' />
		<style type="text/css">
		*{box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;}
		body{background:#3b424d;}
		.content{width:260px;margin:20px auto;}
		.filterinput{
			background-color:rgba(249, 244, 244, 0);
			border-radius:15px;
			width:90%;
			height:30px;
			border:thin solid #FFF;
			text-indent:0.5em;
			font-weight:bold;
			color:#FFF;
		}
		#demo-list a{
			overflow:hidden;
			text-overflow:ellipsis;
			-o-text-overflow:ellipsis;
			white-space:nowrap;
			width:100%;
		}
		</style>
		
		<script src="js/jquery-1.11.2.min.js" type="text/javascript"></script>
		<script src="js/jquery-accordion-menu.js" type="text/javascript"></script>
		<script type="text/javascript">
		
		$(function(){	
			//顶部导航切换
			$("#demo-list li").click(function(){
				$("#demo-list li.active").removeClass("active")
				$(this).addClass("active");
			})	
		})	
		</script>
	</head>
<body>

<div class="content" style="float: left">
	<div id="jquery-accordion-menu" class="jquery-accordion-menu #313131" >
		<div class="jquery-accordion-menu-header" id="form"></div>
		<ul id="demo-list">
		 
		   <li class="active"><a href="http://www.cqut.edu.cn"><i class="fa fa-home"></i>前往学校首页 </a></li>
			<li><a href="#"><i class="fa fa-glass"></i>个人信息管理 </a>
				<ul	class="submenu">
					<li><a href="#" id="d1_1">查看个人信息</a></li>
				</ul>
			</li>
			<li><a href="#"><i class="fa fa-file-image-o"></i>学生选课管理 </a>
				<ul	class="submenu">
					<li><a href="#" id="d2_1">个人选课</a></li>
					<li><a href="#" id="d3_1">选课查询 </a></li>
				</ul></li>
			<li><a href="#"><i class="fa fa-cog"></i>学生成绩管理 </a>
				<ul class="submenu">
					<li><a href="#" id="d4_1">成绩查询 </a></li>
				</ul>
			</li>
			<li><a href="#"><i class="fa fa-home"></i>系统管理 </a>
                <ul class="submenu">
                    <li><a href="#" id="d5_1">学生密码修改 </a></li>
                </ul>
            </li>
			<li><a href="index.jsp"><i class="fa fa-user"></i>注销</a></li>
		</ul>
		<div class="jquery-accordion-menu-footer">
			欢迎使用重庆理工大学教务系统
		</div>
	</div>
</div>

<div class="InfoDiv">
			<div class="d" id="d1_2" title="查看个人信息" align="center" style="overflow-y:auto; ">
				<div>
					<h1 class="cssb7d2c1473196c5" style="font-size: 300%;  color: white;  padding-top: 20px; margin-top: 20px;">查看个人信息</h1>
				</div>
				<hr>
				<div style="width: 50%; min-width: 400px;">
					<form action="searchStudent.action" method="post">
						<span class="fontawesome-user head">&nbsp;学&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;号：</span>
						<input type="text" readonly value="&nbsp;&nbsp;<%=stu.getStuid() %>"><br>
						<span class="fontawesome-user head">&nbsp;姓&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名：</span>
						<input type="text" readonly value="&nbsp;&nbsp;<%=stu.getStuname() %>"><br>
						<span class="fontawesome-user head">&nbsp;性&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;别：</span>
						<input type="text" readonly value="&nbsp;&nbsp;<%=stu.getStusex() %>"><br>
						<span class="fontawesome-user head">&nbsp;身份证号：</span>
						<input type="text" readonly value="&nbsp;&nbsp;<%=stu.getStuidentify() %>"><br>
						<span class="fontawesome-user head">&nbsp;班&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;级：</span>
						<input type="text" readonly value="&nbsp;&nbsp;<%=stu.getClasses().getClassname() %>"><br>
						<span class="fontawesome-user head">&nbsp;专&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;业：</span>
						<input type="text" readonly value="&nbsp;&nbsp;<%=stu.getMajor().getMajorname() %>"><br>
						<span class="fontawesome-user head">&nbsp;院&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;系：</span>
						<input type="text" readonly value="&nbsp;&nbsp;<%=stu.getDept().getDeptname() %>"><br>
						<span class="fontawesome-user head">&nbsp;学&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;制：</span>
						<input type="text" readonly value="&nbsp;&nbsp;<%=stu.getStuedulength() %>"><br>
					</form>	
				</div>
			</div>
			<div class="d" id="d2_2" title="个人选课" align="center">
				<div>
					<h1 class="cssb7d2c1473196c5" style="font-size: 300%;  color: white;  padding-top: 20px; margin-top: 20px;">个人选课</h1>
				</div>
				<hr>
				<div>
					<form action="updateStuCourse.action" method="post">
						<table id="selectC">
							<tr>
								<td>课程编号</td>
								<td>课程名称</td>
								<td>课程学分</td>
								<td>考核方式</td>
								<td>课程性质</td>
								<td>授课教师</td>
								<td></td>
							</tr>
							<%
								StuCourseDAO scDao = new StuCourseDAO();
								List<StuCourse> scList = scDao.findByProperty("id.stuid", (String)session.getAttribute("username"));
								CourClassDAO ccDao = new CourClassDAO();
								List<CourClass> ccList = ccDao.findAll();
								CourClass courClass = new CourClass();
								Iterator<CourClass> ccIterator = ccList.iterator();
								boolean flag = true;
								while(ccIterator.hasNext()) {
									flag = true;
									courClass = ccIterator.next();
									Iterator<StuCourse> scIterator = scList.iterator();
									while(scIterator.hasNext()) {
										if(scIterator.next().getId().getCourseid().equals(courClass.getId().getCourseid())) {
											flag = false;
											break;
										}
									}
									if(flag) {
							%>
									<tr>
										<td><%=courClass.getCourse().getCourseid() %></td>
										<td><%=courClass.getCourse().getCoursename() %></td>
										<td><%=courClass.getCourse().getCredit() %></td>
										<td><%=courClass.getCourse().getExamination() %></td>
										<td><%=courClass.getCourse().getNature() %></td>
										<td><%=courClass.getTeacher().getTeaname() %></td>
										<td><input type="radio" id="rb" value=<%=courClass.getCourse().getCourseid()+";"+courClass.getTeacher().getTeaid()%> name="ctid"></td>
									</tr>
							<%}} %>
						</table>
						<input type="submit" name="updateStuCourse" value="确定" style="width:50%">
					</form>	
				</div>
			</div>
			<div class="d" id="d3_2" title="选课查询" align="center">
				<div>
					<h1 class="cssb7d2c1473196c5" style="font-size: 300%;  color: white;  padding-top: 20px; margin-top: 20px;">选课查询</h1>
				</div>
				<hr>
				<div>
					<table class="table table-border" style="width:80%;color: whitesmoke;">
						<tr>
							<td>课程编号</td>
							<td>课程名称</td>
							<td>任课教师</td>
							<td>课程学分</td>
							<td>课程性质</td>
						</tr>
						<%
							StuCourse sc = new StuCourse();
							scDao = new StuCourseDAO();
							List temp = scDao.findByProperty("id.stuid", (String) session.getAttribute("username"));
							Iterator<StuCourse> itr = temp.iterator();
							sc = new StuCourse();
							while (itr.hasNext())
							{
								sc = itr.next(); %>
								<tr>
									<td><%=sc.getId().getCourseid() %></td>
									<td><%=sc.getTeaCourse().getCoursename() %></td>
									<td><%=sc.getTeaCourse().getTeaname() %></td>
									<td><%=sc.getTeaCourse().getCourse().getCredit() %></td>
									<td><%=sc.getTeaCourse().getCourse().getNature() %></td>
								</tr>
							<%}%>
					</table>
				</div>
			</div>
			<div class="d" id="d4_2" title="成绩查询" align="center">
				<div>
					<h1 class="cssb7d2c1473196c5" style="font-size: 300%;  color: white;  padding-top: 20px; margin-top: 20px;">成绩查询</h1>
				</div>
				<hr>
				<div>
					<table class="table table-border" style="width:80%;color: whitesmoke;">
						<tr>
							<td>课程编号</td>
							<td>课程名称</td>
							<td>课程学分</td>
							<td>课程性质</td>
							<td>课程成绩</td>
						</tr>
						<%
							scDao = new StuCourseDAO();
							temp = scDao.findByProperty("id.stuid", (String) session.getAttribute("username"));
							itr = temp.iterator();
							sc = new StuCourse();
							String check;
							while (itr.hasNext())
							{
								sc = itr.next(); %>
								<tr>
									<td><%=sc.getId().getCourseid() %></td>
									<td><%=sc.getTeaCourse().getCoursename() %></td>
									<td><%=sc.getTeaCourse().getCourse().getCredit() %></td>
									<td><%=sc.getTeaCourse().getCourse().getNature() %></td>
									<%if (sc.getScore() == null)
										{
											check = "";
										}
										else
										{
											check = String.valueOf(sc.getScore());
										}%>
									<td><%=check %></td>
								</tr>
						<%} %>
					</table>
				</div>
			</div>
			<div class="d" id="d5_2" title="学生密码修改" align="center">
				<div>
					<h1 class="cssb7d2c1473196c5" style="font-size: 300%;  color: white;  padding-top: 20px; margin-top: 20px;">学生密码修改</h1>
				</div>
				<hr>
				<div style="width: 50%; min-width: 400px;">
					<form action="updateStudentPwd.action" method="post">
						<span class="fontawesome-user head">&nbsp;原&nbsp;&nbsp;密&nbsp;&nbsp;码：</span>
						<input type="password" name="pwd" value=""><br>
						<span class="fontawesome-user head">&nbsp;新&nbsp;&nbsp;密&nbsp;&nbsp;码：</span>
						<input type="password" name="pwd1" value="">
						<span class="fontawesome-user head">&nbsp;确认密码：</span>
						<input type="password" name="pwd2" value="">
						<input type="submit" value="确定" name="updateStudentPwd">
					</form>		
				</div>
			</div>
</div>
<script type="text/javascript">
(function($) {
$.expr[":"].Contains = function(a, i, m) {
	return (a.textContent || a.innerText || "").toUpperCase().indexOf(m[3].toUpperCase()) >= 0;
};
function filterList(header, list) {
	//@header 头部元素
	//@list 无需列表
	//创建一个搜素表单
	var form = $("<form>").attr({
		"class":"filterform",
		action:"#"
	}), input = $("<input>").attr({
		"class":"filterinput",
		type:"text"
	});
	$(form).append(input).appendTo(header);
	$(input).change(function() {
		var filter = $(this).val();
		if (filter) {
			$matches = $(list).find("a:Contains(" + filter + ")").parent();
			$("li", list).not($matches).slideUp();
			$matches.slideDown();
		} else {
			$(list).find("li").slideDown();
		}
		return false;
	}).keyup(function() {
		$(this).change();
	});
}
$(function() {
	filterList($("#form"), $("#demo-list"));
});
})(jQuery);	
</script>

<script type="text/javascript">

	jQuery("#jquery-accordion-menu").jqueryAccordionMenu();
	
</script>

	<script type="text/javascript">
			$('#d1_1').click(function () {
				$('.d').hide();
				$('#d1_2').show();
			});
			$('#d2_1').click(function () {
				$('.d').hide();
				$('#d2_2').show();
			});
			$('#d3_1').click(function () {
				$('.d').hide();
				$('#d3_2').show();
			});
			$('#d4_1').click(function () {
				$('.d').hide();
				$('#d4_2').show();
			});
			$('#d5_1').click(function () {
				$('.d').hide();
				$('#d5_2').show();
			});
		</script>

</body>
</html>
